package cz.cvut.fit.mi.dpo.mvc.model.elements;

import cz.cvut.fit.mi.dpo.mvc.model.ZeroSizeException;

/**
 * @author David Pertl
 * @author Martin Štekl <steklmar@fit.cvut.cz>
 */
public class Square extends AElement {

	private int edgeLength;

	public Square(int x, int y, int edgeLength) throws ZeroSizeException {
		super(x, y);
		setEdgeLength(edgeLength);
	}

	public int getEdgeLength() {
		return edgeLength;
	}

	public Square setEdgeLength(int edgeLength) throws ZeroSizeException {
		if (edgeLength < 0) {
			throw new ZeroSizeException("Length of square's edge cannot be less than zero.");
		}
		this.edgeLength = edgeLength;
		return this;
	}

}
